require 'msf/core/modules/external/bridge'
require 'msf/core/module/external'

class MetasploitModule < Msf::Auxiliary
  include Msf::Auxiliary::Scanner
  include Msf::Auxiliary::AuthBrute
  include Msf::Module::External

  def initialize
    super({
	  <%= common_metadata meta %>
      'References'  =>
        [
          <%= meta[:references] %>
        ],
      'DisclosureDate' => <%= meta[:date] %>,
      })

      register_options([
        <%= meta[:options] %>
      ])
  end

  def run_host(ip)
    print_status("Running for #{ip}...")
    rhost = datastore.delete('RHOST')
    datastore.remove_option('RHOST') if self.datastore.is_a?(Msf::DataStoreWithFallbacks)
    datastore['rhost'] = rhost
    datastore['userpass'] ||= build_credentials_array
    datastore['sleep_interval'] ||= userpass_interval

    execute_module(<%= meta[:path] %>)
  end
end
